package com.feng.overlay;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;

public class MyOverLay extends Overlay 
{
	private GeoPoint point = null;
	
	public MyOverLay (GeoPoint point)
	{
		this.point = point;
	}

	@Override
	public void draw(Canvas c, MapView mv, boolean shadow) 
	{
		// TODO Auto-generated method stub
		super.draw(c, mv, shadow);
		
		Projection proj = mv.getProjection();
		if (shadow == false)
		{
			Point pt = new Point ();
			proj.toPixels(this.point, pt);
			
			Paint paint = new Paint ();
			paint.setARGB(250, 255, 0, 0);
			paint.setAntiAlias(true);
			paint.setFakeBoldText(true);
			
			int rad = 5;
			RectF oval = new RectF (pt.x-rad, pt.y-rad, pt.x+rad, pt.y+rad);
			
			c.drawOval(oval, paint);
			c.drawText("Red Circle", pt.x+rad, pt.y+rad, paint);
		}
		
	}

	@Override
	public boolean onTap(GeoPoint p, MapView mapView) 
	{
		// TODO Auto-generated method stub
		return super.onTap(p, mapView);
	}
	

}
